Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add egress loss stat #195

Merged
merged 2 commits into from
Jun 28, 2023
Merged

Add egress loss stat #195

merged 2 commits into from
Jun 28, 2023

Conversation

k0nserv
Copy link
Collaborator

@k0nserv k0nserv commented Jun 27, 2023

Add an egress loss stat to PeerStats derived from TWCC reports.

@@ -1088,6 +1088,7 @@ impl TwccSendRegister {
);
}

println!("TWCC loss: {:?}", self.loss(Duration::from_secs(1), now));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soz, left from debugging


Some((lost as f64) / (total as f64))
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit expensive. Is it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be, it's O(2n) at worst with n == 1000 currently and runs every second. I don't really think the 2n case will happen either

src/stats.rs Outdated
@@ -68,6 +70,8 @@ pub struct PeerStats {
pub timestamp: Instant,
/// The last egress bandwidth estimate from the BWE subsystem, if enabled.
pub bwe_tx: Option<Bitrate>,
/// The egress loss over the last second expressed as a percentage value between 0.0 and 1.0.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fraction or ratio?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just multiply by 100 and make it an u8?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think keeping it as f64 would be nice but I can reword it

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f32?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference, I just defaulted to f64. Do we have a stated preference for the project?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, f32 should be sufficient. Will change

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also if you say egress_loss_ratio it is clear that you return a ratio and I will expect numbers between 0 and 1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also if you say egress_loss_ratio it is clear that you return a ratio and I will expect numbers between 0 and 1

Good point, although I know @algesten isn't a fan of long names :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed and type changed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment still percentage

now = now + Duration::from_millis(20);
let loss = reg
.loss(Duration::from_millis(150), now)
.expect("Should be able to calcualte loss");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calculate

@xnorpx
Copy link
Collaborator

xnorpx commented Jun 27, 2023

lgtm

@k0nserv k0nserv merged commit 742bb50 into main Jun 28, 2023
10 checks passed
@k0nserv k0nserv deleted the feature/egress-loss-stat branch June 28, 2023 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants